import math


def operator(func, *args):
    result = func(*args)
    print(f'{func.__name__}_func result: {result}')
    return result


# 加
def add(*args):
    result = 0
    for i in range(len(args)):
        result += args[i]
    return result


# 减
def subtraction(*args):
    result = args[0]
    for i in range(len(args)):
        if i != 0:
            result -= args[i]
    return result


# 乘
def multiplication(*args):
    result = args[0]
    for i in range(len(args)):
        if i != 0:
            result *= args[i]
    return result


# 除
def division(*args):
    result = args[0]
    for i in range(len(args)):
        if i != 0:
            assert args[i] != 0, '被除数不能为0'
            result /= args[i]
    return result


# 整除
def divide_exactly(*args):
    result = args[0]
    for i in range(len(args)):
        if i != 0:
            assert args[i] != 0, '被除数不能为0'
            result //= args[i]
    return result


# 取余
def remainder(*args):
    result = args[0]
    for i in range(len(args)):
        if i != 0:
            result %= args[i]
    return result


# 乘方
def power(*args):
    result = args[0]
    for i in range(len(args)):
        if i != 0:
            result **= args[i]
    return result


# 开方
def evolution(*args):
    return math.sqrt(args[0])


if __name__ == '__main__':
    operator(divide_exactly, 10, 3, 3)
    operator(add, 10, 3, 3)
    operator(subtraction, 10, 3, 3)
    operator(multiplication, 10, 3, 3)
    operator(division, 10, 1, 3)
    operator(remainder, 10, 3, 3)
    operator(power, 10, 3, 3)
    operator(evolution, 10, 0, 3)
